package com.abu.crms.controller;


import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.StrUtil;
import com.abu.crms.config.common.Resp;
import com.abu.crms.pojo.RolePermission;
import com.abu.crms.service.RolePermissionService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 阿布
 * @since 2021-02-05
 */
@RestController
@RequestMapping("/crms/rp")
public class RolePermissionController {

    @Autowired
    private RolePermissionService rolePermissionService;

    @PutMapping("updateRolePermissionList")
    public Resp updatePermissionList(@RequestParam("psIdStr") String psIdStr, @RequestParam("roleId") Long roleId) {
        Boolean flag = this.rolePermissionService.dynamicRemoveOrUpdatePermissions(psIdStr, roleId);
        if (flag) {
            return Resp.ok().msg("权限信息已经更新");
        }
        return Resp.error().msg("更新失败了");
    }
}

